<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"> 
 
<head> 
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 
	<title>湖南省自来水公司营销管理信息系统</title> 
	
	<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/text.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/form.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/buttons.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/grid.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/layout.css" type="text/css" media="screen" title="no title" />
	
	<link rel="stylesheet" href="../../../css/ui-darkness/jquery-ui-1.8.12.custom.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/plugin/jquery.visualize.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/plugin/facebox.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/plugin/uniform.default.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/plugin/dataTables.css" type="text/css" media="screen" title="no title" />
	
	<link rel="stylesheet" href="../../../css/custom.css" type="text/css" media="screen" title="no title">
	
</head> 
 
<body> 

<div id="wrapper">	
	
	<#include "../common/header.ftl"/>

	
	<div id="content" class="xgrid">
		
 		
		<div class="x12">
			
			<h2>
				交施工费 - <a href="/beOrder/be_orderlnfo?orderno=${beOrder.orderno}&OrderType=${beOrder.ordertype}"><input id="orderno" type="hidden" value="${beOrder.orderno}">${beOrder.orderno}</a>
				<a style="float:right" href="javascript:history.back(-1);">返回</a>
			</h2>
            <input type="hidden" id="auditempid" value="${user.id}">
			
			<div class="buttonrow">
                <button class="btn-icon btn-arrow-left btn-red" id="abreak"><span></span>撤回</button>
			<#--onclick="showDialog('确认撤回吗？');"><span></span>撤回</button>-->
                <button class="btn-icon btn-arrow-right btn-blue" id="ago" ><span></span>发送</button>
			<#--onclick="showDialog('确认发送吗？');"><span></span>发送</button>-->
			</div>
			
<table width="100%">
<thead>
	<tr>
		<th width="60"></th>
		<th width="220"></th>
		<th width="60"></th>
		<th width="220"></th>
		<th width="60"></th>
		<th></th>
	</tr>
</thead>
<tbody>
	<tr>
		<td>用户名称</td>
		<td><input readonly="readonly" value="${beOrder.username}" /></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
	</tr>
	<tr>
		<td>总应收</td>
		<td><input readonly="readonly" class="right" value="" id="projectmoneys" /> 元</td>
		<td>总实收</td>
		<td><input readonly="readonly" class="right" value="" id="realmoneys"/> 元</td>
		<td>总欠缴</td>
		<td><input readonly="readonly" class="right" value="" id="zqj"/> 元</td>
	</tr>
</tbody>
</table>
<table class="data display">
<thead>
	<tr>
		<th width="30">序号</th>
		<th width="80">姓名</th>
		<th width="120">应交金额（元）</th>
		<th width="120">实收金额（元）</th>
		<th width="120">发票号</th>
		<th></th>
	</tr>
</thead>
<tbody>
	<#list orderusers as orderuser>
	<tr class="odd">
		<td>1</td>
		<td>${orderuser.username}</td>
		<td><input class="projectmoney" size="12" value=""/></td>
		<td><input class="realmoney" size="12" value=""/></td>
		<td><input class="invoiceno" size="12" value=""/></td>
		<td></td>
	</tr>
	</#list>
</tbody>
</table>

<div class="centerButtons">
	<button class="btn">保存不发送</button>
</div>
			
			
		</div> <!-- .x12 -->
		
	</div> <!-- #content -->
	
	<div id="footer">		
		<div class="content_pad">			
			<p>&copy; 2013-11 版权所有 <a href="#">湖南省自来水公司</a>.   技术支持 <a href="#">华瑞教育</a>.</p>
		</div> <!-- .content_pad -->
	</div> <!-- #footer -->
	
</div> <!-- #wrapper -->

<script src="../../../js/jquery/jquery-1.5.2.min.js"></script>
<script src="../../../js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="../../../js/misc/excanvas.min.js"></script>
<script src="../../../js/jquery/facebox.js"></script>
<script src="../../../js/jquery/jquery.visualize.js"></script>
<script src="../../../js/jquery/jquery.dataTables.min.js"></script>
<script src="../../../js/jquery/jquery.tablesorter.min.js"></script>
<script src="../../../js/jquery/jquery.uniform.min.js"></script>
<script src="../../../js/jquery/jquery.placeholder.min.js"></script>

<script src="../../../js/widgets.js"></script>
<script src="../../../js/dashboard.js"></script>

<script type="text/javascript">
	
$(document).ready ( function () 
{
	Dashboard.init ();		
});

</script>
<script>
    $(function () {
        //保存不发送
        function SetCookie(name,value)//两个参数，一个是cookie的名子，一个是值
        {
            var days = 7; //设置cookie保留7天
            var datime= new Date();
            time.setTime(exp.getTime() + Days*24*60*60*1000);
            document.cookie = name + "="+ escape (value) + ";aa=" + datime.toGMTString();
        }
        //给cookie的name赋值
        function savecookie(){
            var orderno=$("#orderno").val();//#orderno ：表身input标签的id
            var prdname=$("#prdname").val();
            var prdno=$("#prdno").val();
            SetCookie("orderno",orderno);
            SetCookie("prdname",prdname);
            SetCookie("prdno",prdno);
        }
        //获取cookie的值
        function getCookie(name)//取cookies函数
        {
            var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
            if(arr != null) return (arr[2]); return null;
        }
        $("#orderno").val(getCookie("orderno"));
        $("#prdname").val(getCookie("prdname"));
        $("#prdno").val(getCookie("prdno"));



        //发送
        $("#ago").click(function () {
            var al=$("#auditmessage").val();
            alert(al)
            if (al==""){
                alert("审核意见不能为空")
            }else{
                var fal = confirm("确定发送吗");
                if (fal){
                    $.ajax({
                        url:"/beOrder/paygo",    //请求的url地址
                        dataType:"json",   //返回格式为json
                        async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                        data:{
                            "auditempid":$("#auditempid").val(),
                            "orderno":$("#orderno").val()
                        },
                        type:"POST",   //请求方式
                        success:function(req){
                            if (req!=null){
                                $("#auditmessage").val("")
                                window.location.href="http://localhost:8090/suces?pagename=request1";
                                $("#abreak").attr('disabled',true);
                                $("#ago").attr('disabled',true);
                            }else {
                                window.location.href="http://localhost:8090/error";
							}
                        },

                    });
                } else {
                    return false
                }
            }

        })
        $("#abreak").click(function () {
                if (fal){
                    $.ajax({
                        url:"/beOrder/abreak",    //请求的url地址
                        dataType:"json",   //返回格式为json
                        async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                        type:"POST",   //请求方式
						data:{
                            "auditempid":$("#auditempid").val(),
                            "orderno":$("#orderno").val()
						},
                        success:function(req){
                            if (req!=null){
                                window.location.href="http://localhost:8090/suces?pagename=request1";
                            }else{
                                window.location.href="http://localhost:8090/error";
							}
                        },

                    });
                } else {
                    return false
                }
            })
		//总应收
        $('.projectmoney').blur(function(){
            var _total = 0;
            $('.projectmoney').each(function(){
                if(isNaN(this.value))return;
                _total += Number(this.value);
            })
            $('#projectmoneys').val(_total);
            console.log(_total);
            var a=$('#projectmoneys').val();
			var b=$('#realmoneys').val();
            var zqj=b-a;
            $("#zqj").val(zqj);
        })
        //总实收
        $('.realmoney').blur(function(){
            var _total = 0;
            $('.realmoney').each(function(){
                if(isNaN(this.value))return;
                _total += Number(this.value);
            })
            $('#realmoneys').val(_total);
            console.log(_total);
            var a=$('#projectmoneys').val();
            var b=$('#realmoneys').val();
            var zqj=b-a;
            $("#zqj").val(zqj);
        })

        })
</script>

</body> 
 
</html>